package com.leyou.item.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.leyou.common.dto.SkuDTO;
import com.leyou.item.entity.Sku;
import com.leyou.item.mapper.GoodSkuMapper;
import com.leyou.item.service.GoodServiceSku;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodServiceSkuImpl extends ServiceImpl<GoodSkuMapper, Sku> implements GoodServiceSku {
    //根据id批量查询sku
    @Override
    public List<SkuDTO> QueryListSku(List<Long> ids){
        List<Sku> skus = baseMapper.selectBatchIds(ids);
        return SkuDTO.convertEntityList(skus);
    }

    //根据spuID查询sku的集合
    @Override
    public List<SkuDTO> QuerySkuBySpuId(Long id) {
        List<Sku> spu_id = query().eq("spu_id", id).list();
        return SkuDTO.convertEntityList(spu_id);
    }
}
